<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>字符串反转、隐藏</title>
</head>
<script src="https://unpkg.com/vue@next"></script>
<body>
    <div id="root"></div>
    
</body>
<script>

    const app = Vue.createApp({
        data() {
            return {
               content:'hello world' ,
               show:true
            }
        },
        methods: {
            handlerClick() {
                this.content = this.content.split("").reverse().join("");
            },
            handlerClick1() {
                this.show = !this.show;
            }
        },
        template: `
        <span>{{content}}</span>
        <button v-on:click="handlerClick">反转</button>
        <span v-if="show" >{{content}}</span>
        <button v-on:click="handlerClick1">显示隐藏</button>
        `
    }).mount('#root')

</script>
</html>